<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>申请提现</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
    <style>
        .preview_img{ position: absolute; right: 0; top: 0; margin: 0; }
    </style>
</head>
<body>

<div class="layui-form" style="padding: 20px 30px 68px 0;background: #fff;height: 363px;">

    {empty name="record"}

    <div class="layui-form-item" style="color: red;text-align: center;">
        未存在已过审银行卡信息，若已添加银行卡信息请联系管理员将该信息过审。
    </div>

    {else /}

    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 90px;">结算日期</label>
        <div class="layui-input-block" style="margin-left: 120px;">
            <input type="text" id="dayStart" name="settlement_date" placeholder="请选择结算日期" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 98px;">提现金额（元）</label>
        <div class="layui-input-block" style="margin-left: 128px;">
            <input type="number" disabled name="money" lay-verify="money" lay-verType="tips" placeholder="今日还可提现{$balance}元" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux" style="margin-left: 29px;">单笔最低 <span style="color: red">300元</span>、最高 <span style="color: red">100万</span>，今日还可提现 <span style="color: red">{$count}</span> 次</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 90px;">收款银行卡号</label>
        <div class="layui-input-block" style="margin-left: 120px;">
            <input type="text" value="{$record.bank_account}" autocomplete="off" class="layui-input">
        </div>
    </div>

    {/empty}


    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-data-add-submit" id="LAY-data-add-submit" value="确认">
    </div>

</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>

    layui.use('laydate', function () {
        var $ = layui.$;
        var laydate = layui.laydate;

        var nowTime = new Date().valueOf();
        var start = laydate.render({
            elem: '#dayStart',
            type: 'date',
            max: nowTime,
            done: function (value, date) {

                $.ajax({
                    url: "{:url('Withdrawal/agent_balance')}",
                    type: "post",
                    dataType: "json",
                    data: {settlement_date:value},
                    async: true,
                    success: function (rs) {
                        if (rs['code'] == 100) {

                            $('input[name="money"]').val(rs.balance);

                        } else {
                            layer.msg(rs['msg']);
                        }
                        return false;
                    }
                });
            }
        });
    });

    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','table','admin'], function(){
        var $ = layui.$
            ,form = layui.form;

        form.verify({

            money: function (value) {
                if(value < 1){
                    return '提现金额不能小于1';
                }
            }

        });

    })
</script>

</body>
</html>